package com.chagee.store.operation.server.service;

import com.chagee.base.utils.*;
import com.chagee.store.operation.api.request.OrderAppealRequest;
import com.chagee.store.operation.server.model.param.*;
import com.chagee.store.operation.server.model.response.SupplierTaskDetailResponse;
import com.chagee.store.operation.server.model.vo.*;
import com.chagee.store.operation.server.service.biz.SupplierWorkOrderBizService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName SupplierWorkOrderService  //类名称
 * @Description: //类描述：供应商小程序端获取工单信息Service
 * @Author: Jacky-zhan	//作者
 * @CreateDate: 2024/04/25 13:55	//创建时间
 * @UpdateUser: Jacky-zhan	//作者
 * @UpdateDate: 2024/04/25 13:55	//更新时间
 * @UpdateRemark: 更新的信息
 * @Version: 1.0    //版本号
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class SupplierWorkOrderService {

	@Resource
	private SupplierWorkOrderBizService supplierWorkOrderBizService;

	/**
	 * 查询列表
	 *
	 * @param queryParam 入参
	 * @return 出参
	 */
	public PaginationData<SupplierWorkOrderVO> list(PaginationRequest<SupplierWorkOrderQueryParam> queryParam) {
		return supplierWorkOrderBizService.queryList(queryParam);
	}

	/**
	 * 登录人为 城市骨干 角色
	 * @param queryParam
	 * @return
	 */
	public PaginationData<SupplierWorkOrderVO> queryWorkOrderList(PaginationRequest<SupplierWorkOrderQueryParam> queryParam) {

		return supplierWorkOrderBizService.queryWorkOrderList(queryParam);
	}

	/**
	 * 扫码接单
	 *
	 * @param scanCodePlaceOrderParam 入参
	 * @return 出参
	 */
	public ScanResponse queryWorkOrder(ScanCodePlaceOrderParam scanCodePlaceOrderParam) {
		return supplierWorkOrderBizService.queryWorkOrder(scanCodePlaceOrderParam);
	}

	/**
	 * 获取获取 子公司/门店 （主账户查询供应商的子公司/门店，子账户查询自己对应的子公司/门店）
	 *
	 * @param getCompanyStoreParam 获取 子公司/门店 入参
	 * @return list
	 */
	public List<CompanyVO> getCompanyList(GetCompanyStoreParam getCompanyStoreParam) {
		return supplierWorkOrderBizService.getCompanyList(getCompanyStoreParam);
	}

	/**
	 * 获取获取 子公司-门店 （主账户查询供应商的子公司-门店，子账户查询自己对应的子公司-门店）
	 *
	 * @param getCompanyStoreParamPaginationRequest 获取 子公司-门店 入参
	 * @return page对象
	 */
	public PaginationData<CompanyStorePageVO> getCompanyStoreList(PaginationRequest<GetCompanyStoreParam> getCompanyStoreParamPaginationRequest) {
		return supplierWorkOrderBizService.getCompanyStoreList(getCompanyStoreParamPaginationRequest);
	}

	/**
	 * 通过门店编码查询子公司id/name
	 *
	 * @param reQueryCompanyParam 门店编码
	 * @return CompanyStoreVO
	 */
	public CompanyStoreVO reQueryCompanyParam(ReQueryCompanyParam reQueryCompanyParam) {
		return supplierWorkOrderBizService.reQueryCompanyParam(reQueryCompanyParam);
	}

	/**
	 * 点击工单列表查询 工单信息+任务信息
	 *
	 * @param supplierWorkOrderTaskParam 工单id对象
	 * @return 工单信息+任务信息
	 */
	public SupplierWorkOrderTaskVO queryData(SupplierWorkOrderTaskParam supplierWorkOrderTaskParam) {
		return supplierWorkOrderBizService.queryData(supplierWorkOrderTaskParam.getWorkOrderId());
	}

	/**
	 * 根据工单编号查询工单信息
	 *
	 * @param supplierDealWorkOrderParam 工单编号
	 * @return 工单信息
	 */
	public SupplierWorkOrderTaskVO dealWorkOrder(SupplierDealWorkOrderParam supplierDealWorkOrderParam) {
		return supplierWorkOrderBizService.dealWorkOrder(supplierDealWorkOrderParam);
	}

	/**
	 * 供应商确认预打烊交接信息
	 *
	 * @param supplierDeviceConfirmHandoverParam 工单编号+确认预打烊交接信息
	 * @return 工单信息
	 */
	public Boolean confirmHandoverData(SupplierDeviceConfirmHandoverParam supplierDeviceConfirmHandoverParam) {
		return supplierWorkOrderBizService.confirmHandoverData(supplierDeviceConfirmHandoverParam);
	}

	/**
	 * 供应商对工单任务验收结果不合格的提起申诉
	 *
	 * @param submitAppealRequest 提交申诉参数
	 * @return boolean
	 */
	public Boolean submitAppeal(SubmitAppealRequest submitAppealRequest) {
		return supplierWorkOrderBizService.submitAppeal(submitAppealRequest);
	}

	/**
	 * 供应商对工单的单独任务进行处理/修改
	 *
	 * @param supplierDealTaskRequest 任务处理/修改入参对象
	 * @return TaskExecutionDetailResponse
	 */
	public TaskExecutionDetailResponse dealTask(SupplierDealTaskRequest supplierDealTaskRequest) {
		return supplierWorkOrderBizService.dealTask(supplierDealTaskRequest);
	}

	public SupplierTaskDetailResponse getTaskInfo(SupplierTaskExecutionParam supplierDealTaskRequest) {
		Long executionId = supplierDealTaskRequest.getTaskExecutionId();
		return supplierWorkOrderBizService.getTaskInfo(executionId);
	}
	/**
	 * 过期工单发起申述
	 * @param orderAppealRequest
	 * @return
	 */
	public Boolean orderAppeal(OrderAppealRequest orderAppealRequest) {

		return supplierWorkOrderBizService.orderAppeal(orderAppealRequest);
	}
}
